home *** CD-ROM | disk | FTP | other *** search
- {********************************************}
- {* *}
- {* SWITCH.PAS generated from SWITCH.VBX *}
- {* *}
- {********************************************}
-
- unit Switch;
-
- interface
-
- uses SysUtils, Classes, Graphics, Forms, Controls, VBXCtrl, BIVBX;
-
- { $DEFINE InitTBiSwitch}
- {^- Remove space to enable default init data -- See documentation. }
-
- type
- TBiSwitchOnEvent = procedure (Sender: TObject) of object;
- TBiSwitchOffEvent = procedure (Sender: TObject) of object;
-
- { TBiSwitch }
-
- TBiSwitch = class(TVBXControl)
- protected
- FOnOn: TBiSwitchOnEvent;
- FOnOff: TBiSwitchOffEvent;
- { Event handler }
- procedure HandleVBXEvent(var Message: TWMVBXFireEvent); override;
- public
- constructor Create(AOwner: TComponent); override;
-
- property Index: TVBInteger index 1 read GetIntProp;
- published
- property Visible;
- property ForeColor: TColor index 10 read GetColorProp write SetColorProp
- default -2147483640;
- property BackColor: TColor index 11 read GetColorProp write SetColorProp
- default -2147483633;
- property Caption;
- property BorderStyle: TVBEnum index 13 read GetEnumProp write SetEnumProp
- default 0;
- property pOn: Boolean index 14 read GetBoolProp write SetBoolProp;
- property TextPosition: TVBEnum index 15 read GetEnumProp write
- SetEnumProp default 0;
- property Font;
- property ParentFont;
- property TabStop;
- property TabOrder;
- property DragMode;
- property DragCursor;
- property OnOn: TBiSwitchOnEvent read FOnOn write FOnOn;
- property OnOff: TBiSwitchOffEvent read FOnOff write FOnOff;
- property OnMouseMove;
- property OnMouseDown;
- property OnMouseUp;
- property OnKeyDown;
- property OnKeyUp;
- property OnKeyPress;
- property OnEnter;
- property OnExit;
- property OnDragOver;
- property OnDragDrop;
- property OnEndDrag;
- end;
-
- procedure Register;
-
- implementation
-
- { Default form data for TBiSwitch }
-
- {$IFDEF InitTBiSwitch}
-
- const
- TBiSwitchInitLen = 57;
-
- procedure TBiSwitchInitData; near; assembler;
- asm
- DB $00,$08,$42,$69,$53,$77,$69,$74,$63,$68,$01,$00,$00,$02,$06,$FF
- DB $FF,$08,$00,$0A,$00,$00,$00,$00,$0B,$0F,$00,$00,$80,$0C,$08,$42
- DB $49,$53,$57,$49,$54,$43,$48,$0D,$00,$0E,$00,$00,$0F,$00,$10,$00
- DB $16,$00,$00,$17,$00,$00,$18,$00,$FF
- end;
-
- {$ENDIF}
-
- { TBiSwitch }
-
- constructor TBiSwitch.Create(AOwner: TComponent);
- begin
- FVBXFile := StrNew('SWITCH.VBX');
- FVBXClass := StrNew('BISWITCH');
- SetBounds(0, 0, 80, 32);
- inherited Create(AOwner);
- ControlStyle := ControlStyle - [csCaptureMouse, csClickEvents];
- TabStop := True;
- FVBXFlags := [vfProcessMnemonic];
- {$IFDEF InitTBiSwitch}
- FHForm := VBXCreateFormFile(TBiSwitchInitLen, @TBiSwitchInitData);
- {$ENDIF}
- end;
-
- procedure TBiSwitch.HandleVBXEvent(var Message: TWMVBXFireEvent);
- begin
- case Message.VBXEvent^.EventIndex of
- 0: DispatchCustomEvent(FOnOn, Message, 0);
- 1: DispatchCustomEvent(FOnOff, Message, 1);
- 2: DispatchMouseMoveEvent(OnMouseMove, Message);
- 3: DispatchMouseEvent(OnMouseDown, Message);
- 4: DispatchMouseEvent(OnMouseUp, Message);
- 5: DispatchKeyEvent(OnKeyDown, Message);
- 6: DispatchKeyEvent(OnKeyUp, Message);
- 7: DispatchKeyPressedEvent(OnKeyPress, Message);
- 8: begin end; { VCL Handles OnGotFocus }
- 9: begin end; { VCL Handles OnLostFocus }
- 10: begin end; { VCL Handles OnDragOver }
- 11: begin end; { VCL Handles OnDragDrop }
- end;
- end;
-
- { Designer registration }
- procedure Register;
- begin
- RegisterComponents('VBX', [TBiSwitch]);
- end;
-
- end.
-